package cn.zshprint.serein.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * es产品
 * 搜索中的商品信息
 * Created by macro on 2018/6/19.
 *
 * @author zshprint
 * @date 2021/07/29
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Document(indexName = "serein")
public class EsProduct implements Serializable {
    /**
     * id
     */
    @Id
    private Integer id;
    /**
     * 商店id
     */
    @Field(type = FieldType.Keyword)
    private Integer shopId;
    /**
     * 类别id
     */
    @Field(type = FieldType.Keyword)
    private Integer categoryId;
    /**
     * 的名字
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String name;
    /**
     * 虚假的价格
     */
    @Field(type = FieldType.Double)
    private Double falsePrice;
    /**
     * 真正的价格
     */
    @Field(type = FieldType.Double)
    private Double truePrice;
    /**
     * 图像
     */
    @Field(type = FieldType.Keyword, index = false)
    private String image;
    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Field(type = FieldType.Date, index = false)
    private LocalDateTime createTime;
    /**
     * 更新时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Field(type = FieldType.Date, index = false)
    private LocalDateTime updateTime;
}

